package com.cash.channel.web.controller;

import com.cash.channel.web.annotation.RestControllerMapper;
import com.cash.channel.api.exception.CashChannelException;
import com.cash.channel.web.model.RequestModel;
import com.cash.channel.api.util.ApiUtils;
import com.cash.common.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Slf4j
@RestControllerMapper("/contract")
public class ContractController extends BaseController {

    @PostMapping("/show")
    public Result show(@RequestBody RequestModel requestModel) {
        try {
            return doDispatch("contractShow", requestModel, dataMap -> {
                ApiUtils.checkParamsExist(dataMap, "orderNo","contractNo");
            });
        } catch (CashChannelException e) {
            log.error(e.getErrMessage(), e);
            return Result.failed(e.getErrMessage());
        }
    }

}
